//
//  MainViewController.swift
//  swiftwb
//
//  Created by jiasongkai on 15/7/5.
//  Copyright © 2015年 jiasongkai. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        addChildViewControllers()
    }

    
    func addChildViewControllers() {
        tabBar.tintColor = UIColor.orangeColor()
        addChildVC("Home", "首页", "tabbar_home")
        addChildVC("Message", "消息", "tabbar_message_center")
        addChildVC("Discover", "发现", "tabbar_discover")
        addChildVC("Profile", "我", "tabbar_profile")
        
    }
    
    func addChildVC(sbName : String, _ title : String, _ imageNamed : String) {
        let vc = UIStoryboard(name: sbName, bundle: nil).instantiateInitialViewController()
        
        let nav = SKBaseViewController(rootViewController: vc!)
//        let nav = UINavigationController(rootViewController: vc!) as! SKBaseViewController
        vc!.title = title
        nav.tabBarItem.image = UIImage(named: imageNamed);
        nav.tabBarItem.selectedImage = UIImage(named: imageNamed + "_highlighted")
        addChildViewController(nav)
        
    }
    
    
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

   
}
